<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<html>
<head>
<title>fangbing</title>
<link href="/res/css/bootstrap.css" rel="stylesheet">
<link href="/res/css/metisMenu.css" rel="stylesheet">
<link href="/res/css/fullcalendar.css" rel="stylesheet">
<link href="/res/css/jquery-ui.css" rel="stylesheet">
<link href="/res/css/sb-admin-2.css" rel="stylesheet">
<link href="/res/css/font-awesome.css" rel="stylesheet">
<link href="/res/css/bootstrap-datetimepicker.css" rel="stylesheet">


<script src="/res/js/moment.js"></script>
<script src="/res/js/jquery-2.1.4.js"></script>
<script src="/res/js/bootstrap.js"></script>
<script src="/res/js/jquery-ui.js"></script>
<script src="/res/js/fullcalendar.js"></script>
<script src="/res/js/metisMenu.js"></script>
<script src="/res/js/sb-admin-2.js"></script>
<script src="/res/js/bootstrap-datetimepicker.js"></script>
<script src="/res/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
</head>

<body>
	<div class="row">
		<div class="col-lg-12">
			<div class="panel panel-default panel-success">
				<div class="panel-heading">
					<h1>
						月经计算 <small>月经计算基本信息注册</small>
					</h1>
				</div>
				<div class="panel-body">
					<form class="form-horizontal" id ="submitForm" method="post">
						<div class="form-group">
							<label for="menstruationNumOfDay" class="col-sm-2 control-label">经期天数</label>
							<div class="input-group col-sm-10">
								<input type="hidden" id="userId" name="userId" value ="${menstruationBase.userId}"/>
								<input type="text" class="form-control" name="menstruationNumOfDay" id="menstruationNumOfDay"
									placeholder="经期持续天数" value="${menstruationBaseVo.menstruationNumOfDay}">
							</div>
						</div>
						<div class="form-group">
							<label for="cycleNumOfDay" class="col-sm-2 control-label">周期天数</label>
							<div class="input-group col-sm-10">
								<input type="text" class="form-control" id="cycleNumOfDay" name = "cycleNumOfDay"
									placeholder="两次月经第一天的间隔天数" value="${menstruationBaseVo.cycleNumOfDay}">
							</div>
						</div>
						<div class="form-group">
							<label for="dtp_input2" class="col-sm-2 control-label">最近一次月经第一天</label>
							<div class="input-group date form_date col-sm-10" data-date="" data-date-format="yyyy-mm-dd" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
                    			<input class="form-control" size="10" readonly 
                    			placeholder="最近一次月经第一天日期" id="nearMenstruationFirstDay" 
                    			name="nearMenstruationFirstDay" type="text" 
                    			value="${menstruationBaseVo.nearMenstruationFirstDay}">
								<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                			</div>
								<input type="hidden" id="dtp_input2"/><br/>
						</div>
						<div class="form-group">
							<div class="col-sm-offset-2 col-sm-10">
							<c:if test="${menstruationBaseVo.userId==null}">
								<button type="button" id = "add" class="btn btn-default">保存</button>
							</c:if>
							<c:if test="${menstruationBaseVo.userId!=null}">
								<button type="button" id = "update" class="btn btn-default">修改</button>
							</c:if>
								<button type="button" id = "return" class="btn btn-default">取消</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</body>
<script>
        $("#return").click(function(){
        	window.location.href = "/menstruation/search.do";
        });
        
        $("#add").click(function(){
        	alert("保存成功！");
        	$("#submitForm").attr("action", "/menstruation/add.do");
            $("#submitForm").submit();
        });
        
        $("#update").click(function(){
        	alert("修改成功！");
        	$("#submitForm").attr("action", "/menstruation/update.do");
            $("#submitForm").submit();
        });
        
        //日期控件
       $('.form_date').datetimepicker({
    	language: 'zh-CN',
        weekStart: 1,
        todayBtn:  1,
		autoclose: 1,
		todayHighlight: 1,
		startView: 2,
		minView: 2,
		forceParse: 0
    });
        
</script>
</html>
